<?php

declare(strict_types=1);

namespace app\admin\controller;

use addons\Builder\facade\Builder;
//该文件为自动生成，请按需修改
class PaperBank extends Base
{
    //主键，默认为id
    protected string $pk = 'id';

    protected $append = ['cateText', 'typesText', 'titleText'];
    //主模型
    protected string $model = '\app\common\model\PaperBank';

    public function index($id): string
    {
        
        $map[] = ['paper_id', '=', $id];
        return Builder::Table()
            ->autoStructure($this->model, $this->pk, 'barDemo,200')

            ->addTopButtons([
                'add_radio' => [
                    'title'       => '添加单选题',
                    'url'   => url('exam/index')->build().'?addExam=1&types=1&paper_id='.$id,
                    'w' => '90%',
                    'h' => '90%',
                    'class'=>'layui-btn layui-btn-normal layui-btn-sm',
                    'event' => 'addExam'
                ],
                'add_check' => [
                    'title'       => '添加多选题',
                    'url'   => url('exam/index')->build().'?addExam=1&types=2&paper_id='.$id,
                    'w' => '90%',
                    'h' => '90%',
                    'class'=>'layui-btn layui-btn-normal layui-btn-sm',
                    'event' => 'addExam'
                ],
            ])
            ->addRightButtons(
                [
                    'delete'
                ]
            )
            ->addExtraMap($map)
            ->fetch();
    }
}
